using System;
using MtApi;
using MTEA.WatchDog;
using System.Diagnostics;

namespace MTEA.State
{
    class MTState: IWatchable
    {
        protected IStateMachine stateMachine;
        protected MtApiClient client;
        private ulong watchToken;

        public virtual string Name
        {
            get
            {
                return this.ToString();
            }
        }

        public MTState(IStateMachine stateMachine, MtApiClient client)
        {
            Debug.Assert(stateMachine != null);
            this.stateMachine = stateMachine;
            this.client = client;
            watchToken = 10;
        }

        public virtual void Execute(MTStateContext context) {
            watchToken++;
        }

        public ulong GetCurrentToken()
        {
            return watchToken;
        }

        public void setNextState(MTState state)
        {
            stateMachine.setState(state);
        }
    }
}